#ifndef __KEY_H
#define __KEY_H

#include "main.h"
/*--------------------------KEY-----------------------*/		
enum KEY_STATE
{
	KS_RELEASE,
	KS_SHAKE,
	KS_KEEP,
	KS_WAIT_RELEASE
};

enum KEY_EVENT
{
	KE_NULL,
	KE_SHORT,
	KE_LONG
};

typedef struct
{
	uint8_t key_state;
	uint8_t last_key_state;
	uint8_t key_event;
	uint32_t key_time;
}KEY;

#define 	KEY_UP 		GPIO_PIN_SET
#define 	KEY_DOWN 	GPIO_PIN_RESET

#define 	KEY_SHAKE_TIME 	  20
#define 	KEY_LONG_TIME 	  300


extern KEY key[4];

void key_scan(void);
void key_func(void);

#endif
